<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
    <!-- bootstrap styles -->
    <link th:href="@{css/bootstrap.css}" th:rel="stylesheet" media="all" />
    <!-- font-awesome styles -->
    <link th:href="@{css/font-awesome.css}" th:rel="stylesheet" media="all"/>
    <!-- google styles -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
    <link th:href="@{css/common.css}" th:rel="stylesheet"/>

    <!-- header -->
    <div class="container top-header">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#x-navbar-collapse" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <div class="logo">
                        <a th:href="index">JGr<i class="fa fa-lightbulb-o"></i>wth</a>
                    </div>
                </div>

                <div class="collapse navbar-collapse" id="x-navbar-collapse">
                    <ul id="classification" class="nav navbar-nav">
                        <li>
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">文章</a>
                            <ul class="dropdown-menu">
                                <li><a th:href="@{get_articles_tag(type='Java语言基础')}">Java语言基础</a></li>
                                <li><a th:href="@{get_articles_tag(type='经典算法')}">经典算法</a></li>
                                <li><a th:href="@{get_articles_tag(type='数据库')}">数据库</a></li>
                                <li><a th:href="@{get_articles_tag(type='设计模式')}">设计模式</a></li>
                                <li><a th:href="@{get_articles_tag(type='Web')}">Web</a></li>
                            </ul>
                        </li>
                        <li><a th:href="coding">编程</a></li>
                        <li><a th:href="architect">Java技能树</a></li>
                    </ul>
                    <div class="search">
                        <form th:action="do_search" method="post">
                            <input name="keywords" type="search" placeholder="想搜点什么呢" onfocus="if(this.value=='想搜点什么呢'){this.value='';}" onblur="if(this.value==''){this.value='想搜点什么呢';}" required="true"/>
                            <button type="submit" class="btn btn-default" aria-label="Left Align">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </button>
                        </form>
                    </div>
                    <ul class="nav navbar-nav navbar-right">
                        <li th:switch="${session.login_status}" class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <img id="avatar" th:src="@{${session.avatar}}" th:if="${session.login_status}" alt=""/>
                                [[${session.username}?:'请登录']]
                            </a>
                            <!-- user -->
                            <ul th:case="1" class="dropdown-menu">
                                <li><a href="#">个人信息</a></li>
                                <li><a th:href="get_articles_username">我的文章</a></li>
                                <li><a th:href="@{editor}">发表文章</a></li>
                                <li><a th:href="do_loginOut">注销</a></li>
                            </ul>
                            <!-- admin -->
                            <ul th:case="3" class="dropdown-menu">
                                <li><a href="#">个人信息</a></li>
                                <li><a th:href="get_articles_username">我的文章</a></li>
                                <li><a th:href="@{editor}">发表文章</a></li>
                                <li><a href="admin">后台</a></li>
                                <li><a th:href="do_loginOut">注销</a></li>
                            </ul>
                            <!-- root -->
                            <ul th:case="4" class="dropdown-menu">
                                <li><a href="#">个人信息</a></li>
                                <li><a th:href="get_articles_username">我的文章</a></li>
                                <li><a th:href="@{editor}">发表文章</a></li>
                                <li><a href="admin">后台</a></li>
                                <li><a th:href="do_loginOut">注销</a></li>
                            </ul>
                            <!-- anonymous -->
                            <ul th:case="*" class="dropdown-menu">
                                <li><a th:href="register">注册</a></li>
                                <li><a th:href="login">登录</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
    <!-- header end -->
</html>